package com.live.dengdengtv.utils;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by wyf on 2016/11/2.
 */
public class EmptyViewUtil {
    public static View getEmptyView(Context context) {
        TextView emptyView = new TextView(context);
        emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        emptyView.setTextColor(0XFF999999);
        emptyView.setTextSize(16);
        emptyView.setText("没有数据！");
        emptyView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
        emptyView.setVisibility(View.GONE);
        return emptyView;
    }

    public static View getEmptyView(Context context, String s) {
        TextView emptyView = new TextView(context);
        emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        emptyView.setTextColor(0XFF999999);
        emptyView.setTextSize(16);
        emptyView.setText(s);
        emptyView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
        emptyView.setVisibility(View.VISIBLE
        );
        return emptyView;
    }
}
